package com.iacrqq.sedaf.queue;

/**
 * 
 * @author sihai
 *
 */
public class QueueRuntimeStatistics
{
	private int size;								// 
	private int capacity;							// 
	private volatile long full;						//	
	private volatile long empty;					// 
	private double elementAverageWaitingTime;		// 元素等待时间，ms
	
	public int getSize()
	{
		return size;
	}
	public int getCapacity()
	{
		return capacity;
	}
	public double getElementAverageWaitingTime()
	{
		return elementAverageWaitingTime;
	}
	
	public double getUsedRate()
	{
		return (size + 0.0D) / capacity;
	}
	
	public void setSize(int size)
	{
		this.size = size;
	}
	public void setCapacity(int capacity)
	{
		this.capacity = capacity;
	}
	public void setElementAverageWaitingTime(double elementAverageWaitingTime)
	{
		this.elementAverageWaitingTime = elementAverageWaitingTime;
	}
	
	public long getFull() 
	{
		return full;
	}
	public void setFull(long full) 
	{
		this.full = full;
	}
	public long getEmpty() 
	{
		return empty;
	}
	public void setEmpty(long empty) 
	{
		this.empty = empty;
	}
	
	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append("QueueRuntimeStatistics{");
		sb.append("size:");
		sb.append(size);
		sb.append(",capacity:");
		sb.append(capacity);
		sb.append(",full:");
		sb.append(full);
		sb.append(",empty:");
		sb.append(empty);
		sb.append(",elementAverageWaitingTime:");
		sb.append(elementAverageWaitingTime);
		sb.append("}");
		return sb.toString();
	}
}
